package com.food.controller;

import com.food.common.Result;
import com.food.model.Food;
import com.food.service.FoodRecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/food/recommendation")
public class FoodRecommendationController {

    @Autowired
    private FoodRecommendationService recommendationService;

    @GetMapping
    public Result<List<Food>> getRecommendedFoods(@RequestParam Integer userId) {
        List<Food> foods = recommendationService.getRecommendedFoods(userId);
        return Result.success(foods);
    }

    @GetMapping("/meal-type/{mealType}")
    public Result<List<Food>> getRecommendedFoodsByMealType(
            @RequestParam Integer userId,
            @PathVariable String mealType) {
        List<Food> foods = recommendationService.getRecommendedFoodsByMealType(userId, mealType);
        return Result.success(foods);
    }

    @GetMapping("/nutrition")
    public Result<List<Food>> getRecommendedFoodsByNutrition(@RequestParam Integer userId) {
        List<Food> foods = recommendationService.getRecommendedFoodsByNutrition(userId);
        return Result.success(foods);
    }

    @GetMapping("/preference")
    public Result<List<Food>> getRecommendedFoodsByPreference(@RequestParam Integer userId) {
        List<Food> foods = recommendationService.getRecommendedFoodsByUserPreference(userId);
        return Result.success(foods);
    }

    @GetMapping("/goal")
    public Result<List<Food>> getRecommendedFoodsByGoal(@RequestParam Integer userId) {
        List<Food> foods = recommendationService.getRecommendedFoodsByUserGoal(userId);
        return Result.success(foods);
    }
} 